//
//  Tools.m
//  Go!
//
//  Created by 凌風 on 16/7/7.
//  Copyright © 2016年 凌风. All rights reserved.
//

#import "Tools.h"
#import "NetWorkManager.h"

@interface Tools ()

@end

@implementation Tools

+ (void)showAlertWithMessage:(NSString *)msg {
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:msg preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]];
    UIViewController * rootVc = [[[UIApplication sharedApplication] keyWindow] rootViewController];
    
    [rootVc presentViewController:alert animated:YES completion:nil];
}

+ (void)showAlertWithMessage:(NSString *)msg ViewController:(UIViewController *)vc {
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:msg preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]];
    
    [vc presentViewController:alert animated:YES completion:nil];
}

+ (void)getAllCityAndBizarea:(NSDictionary *)citysdict{
    NSArray *citysarray = [NSArray arrayWithArray:[citysdict valueForKey:@"cities"]];
    NSMutableArray *cityid = [NSMutableArray array];
    NSMutableArray *cityname = [NSMutableArray array];
    for (int i = 0; i < citysarray.count; i++) {
        [cityid addObject:citysarray[i][@"city_id"]];
        [cityname addObject:citysarray[i][@"city_name"]];
    }
    for (int i = 0; i < 1; i ++) {
        [NetWorkManager getWithURL:@"districts" urlParam:@{@"city_id":cityid[i]} successBlock:^(id responseObject) {
            [Tools getDistrictName:responseObject];
        } FailureBlock:^(NSError *error) {
            
        }];
    }
}

+(NSArray *)getDistrictName:(NSDictionary *)dict{
    return nil;
}







@end
